$(function () {

    $(".login_info").hide()

    $.ajax({
        url: '/df_api/v1/session_check',
        method: "GET",
        type: "json",
        success: function (response) {
            // console.log(response)
            if (response.code === 0){
                $(".login_info").children("em").text(response.user.username)
                $(".login_info").show()

                $(".login_btn").hide()

            }
        }
    })


    $(".loginout").click(function (e) {
        e.preventDefault()
         $.ajax({
        url: '/df_api/v1/session_clear',
        method: "GET",
        type: "json",
        success: function (response) {
            console.log(response)
            if (response.code === 0){
                location.href = "/static/index.html"
            }
        }
    })
    })


})